<?php 
defined('BASEPATH') or exit('No direct script access allowed');

class Weixin extends MY_Controller{
    
    private $AppID; //应用ID
    private $AppSecret; //应用密匙
    
    public function __construct(){
        parent::__construct();
        $this->AppID = C('weixin.base.AppID.id');
        $this->AppSecret = C('weixin.base.AppSecret.id');
    }
    
    
    /**
     * 获取code
     */
    public function get_code(){
        $data =$this->data;
        $redirect_url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid='.$this->AppID;
        $redirect_url .= '&redirect_uri='.urlencode($this->data['domain']['wei']['url'].'/weixin/weixin_login/');
        $redirect_url .= "&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
        header('location:' . $redirect_url);
        exit;
    }
    
    public function weixin_login(){
        echo 1;
    }
    
    
}